﻿#region Using directives

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

#endregion

namespace OpenComposite.Inbox.Attachments
{
	partial class frmSplash : Form
	{
		private string _path;

		public frmSplash(string path)
		{
			InitializeComponent();
			this._path = path;
		}

		private void btnuploadAndReturn_Click(object sender, EventArgs e)
		{
			if ( CanRead() ) {
				this.DialogResult = DialogResult.OK;
				this.Hide();
			} else {
				MessageBox.Show("Please close your application before returning to the attachment view!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
		}

		private void frmSplash_Load(object sender, EventArgs e)
		{

		}

		private bool CanRead()
		{
			try {
				FileStream fsAct = new FileStream(_path, FileMode.Open, FileAccess.Read, FileShare.Read);
				fsAct.Close();
				return true;
			} catch {
				return false;
			}
		}

		private void label3_Click(object sender, EventArgs e)
		{

		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
			this.Hide();
		}
	}
}
